import i18n from '@/i18n'
import { hasPermission } from '@/utils'
import { RenderName, RenderBotNumber, RenderModelNumber, RenderJira, RenderStatus, RenderBussinessType, RenderTimeFormat } from './element'


export const renderColumns = () => [
  {
    field: 'name',
    headerText: i18n.t('custom.reports.name'),
    width: 150,
    clipMode: 'EllipsisWithTooltip',
    template: RenderName
  },
  {
    field: 'description',
    headerText: i18n.t('custom.accounting.description'),
    width: 150,
    clipMode: 'EllipsisWithTooltip'
  },

  {
    headerText: i18n.t('custom.reports.integration'),
    width: 130,
    field: 'integrations',
    clipMode: 'EllipsisWithTooltip'
  },
  {
    field: 'businessType',
    headerText: i18n.t('custom.reports.businessType'),
    width: 100,
    template: RenderBussinessType
  },
  {
    field: 'status',
    headerText: i18n.t('custom.widget.status'),
    width: 100,
    template: RenderStatus
  },
  {
    field: 'lastSyncDate',
    headerText: i18n.t('custom.dataset.lastSynced'),
    width: 100,
    format: (value) => timeFormat(value)
  },
  {
    field: 'modelNum',
    headerText: i18n.t('custom.dataset.linkedbtn'),
    width: 160,
    textAlign: 'Center',
    visible: hasPermission('sys:dataset:linkedbtn'),
    template: RenderModelNumber
  },
  {
    field: 'botNum',
    headerText: i18n.t('custom.dataset.linkedbotbtn'),
    width: 160,
    textAlign: 'Center',
    visible: hasPermission('sys:dataset:linkedbtn'),
    template: RenderBotNumber
  },
  {
    field: 'creatorName',
    headerText: i18n.t('custom.widget.creator'),
    width: 100,
    visible: hasPermission('sys:dataset:creator'),

  },
  {
    field: 'createDate',
    headerText: i18n.t('custom.widget.createddate'),
    width: 180,
    visible: hasPermission('sys:dataset:creator'),
    format: (value) => timeFormat(value)

  },
  {
    visible: hasPermission('sys:dataset:creator'),
    field: 'updateByName',
    headerText: i18n.t('custom.widget.lastupdatedby'),
    width: 150
  },
  {
    field: 'updateDate',
    headerText: i18n.t('custom.reports.updateDate'),
    width: 170,
    format: (value) => timeFormat(value)

  },
  {
    field: 'jiraNumber',
    headerText: i18n.t('custom.reports.jiraNumber'),
    width: 120,
    clipMode: 'EllipsisWithTooltip',
    template: RenderJira,
    visible: hasPermission('sys:dataset:owner')
  },
  {
    field: 'poName',
    headerText: i18n.t('custom.reports.poName'),
    width: 80,
    clipMode: 'EllipsisWithTooltip',
    visible: hasPermission('sys:dataset:owner')
  },
  {
    field: 'daName',
    headerText: i18n.t('custom.reports.daName'),
    width: 80,
    clipMode: 'EllipsisWithTooltip',
    visible: hasPermission('sys:dataset:owner')
  }
]
